package com.yin.spring5.dao;

import com.yin.spring5.entity.Book;

import java.util.List;

/**
 * BookDao
 *
 * @author Yin Guiqing
 */
public interface BookDao {
    int insert(Book book);

    int update(Book book);

    int delete(Integer id);

    /**
     * 查询表中记录数
     *
     * @return 记录数
     */
    int recordCount();

    /**
     * 根据 id 查询
     *
     * @param id 要查询的 id
     * @return 查询到的对象
     */
    Book getOneById(Integer id);

    /**
     * 查询所有记录
     *
     * @return 所有记录的 List 集合
     */
    List<Book> getAll();

    /**
     * 批量插入记录
     *
     * @param bookList the List of Object arrays containing the batch of
     *                 arguments for the query
     * @return an array containing the numbers of rows affected by each
     * update in the batch
     */
    int[] batchInsert(List<Object[]> bookList);

    /**
     * 批量修改记录
     *
     * @param bookList the List of Object arrays containing the batch of
     *                 arguments for the query
     * @return an array containing the numbers of rows affected by each
     * update in the batch
     */
    int[] batchUpdate(List<Object[]> bookList);

    /**
     * 批量删除记录
     *
     * @param idList the List of Object arrays containing the batch of
     *                 arguments for the query
     * @return an array containing the numbers of rows affected by each
     * update in the batch
     */
    int[] batchDelete(List<Object[]> idList);
}
